package com.atguigu.crowd.api;

import com.atguigu.crowd.entity.po.MemberPO;
import com.atguigu.crowd.entity.vo.*;
import com.atguigu.crowd.util.ResultEntity;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Component
@FeignClient("mysql-provider") //对应mysql-provider的微服务
public interface MySQLRemoteService {


    //用户申请延期功能
    @RequestMapping("/update/member/applyDelay/remote")
    public ResultEntity<String> updateMemberApplyRemote(
            @RequestParam("projectId") Integer projectId,
            @RequestParam("delayDay") Integer delayDay,
            @RequestParam("delayNumber") Integer delayNumber
    );


    //获取用户发起的项目
    @RequestMapping("/get/member/my/crowd/project/remote")
    public ResultEntity<List<DetailProjectVO>> getMemberCrowdProjectRemote(@RequestParam("memberId") Integer memberId);


    /**
     * 登录远程接口
     *
     * @param loginacct
     * @return
     */
    @RequestMapping("/get/memberpo/by/login/acct/remote")
    //  @ResponseBody
    public ResultEntity<MemberPO> getMemberPOByLoginAcctRemote(@RequestParam("loginacct") String loginacct);

    //注册
    @RequestMapping("/save/member/remote")
    public ResultEntity<String> saveMember(
            @RequestBody MemberPO memberPO
    );


    @ResponseBody
    //保存 项目发起的所有项目相关信息
    @RequestMapping("/save/project/vo/remote")
    ResultEntity<String> saveProjectVORemote(@RequestBody ProjectVO projectVO, @RequestParam("memberId") Integer memberId);

    /**
     * 查询获得PortalTypeVO信息
     *
     * @return
     */
    @RequestMapping("/get/portal/type/project/data/remote")
    public ResultEntity<List<PortalTypeVO>> getPortalTypeProjectDataRemote();

    /**
     * 根据项目ID查询项目详情信息
     */
    @RequestMapping("/get/project/detail/remote/{projectId}")
    public ResultEntity<DetailProjectVO> getDetailProjectVORemote(@PathVariable("projectId") Integer projectId);


    /**
     * 在项目详情页点击支持后 查询数据库拿到确认回报内容的信息
     *
     * @param projectId
     * @param returnId
     * @return
     */
    @ResponseBody
    @RequestMapping("/get/order/project/vo/remote")
    ResultEntity<OrderProjectVO> getOrderProjectVORemote(@RequestParam("projectId") Integer projectId, @RequestParam("returnId") Integer returnId);


    /**
     * 确认订单页 查询收获地址信息
     *
     * @param memberId
     * @return
     */
    @RequestMapping("/get/address/vo/remote")
    public ResultEntity<List<AddressVO>> getAddressVORemote(@RequestParam("memberId") Integer memberId);


    //创建新地址后进行保存新地址
    @RequestMapping("/save/address/remote")
    public ResultEntity<String> saveAddressRemote(@RequestBody AddressVO addressVO);

    //保存OrderVO到数据库
    @RequestMapping("/save/order/remote")
    ResultEntity<String> saveOrderRemote(@RequestBody OrderVO orderVO);


    //根据memberId获取此用户是否已经有发起人信息
    @RequestMapping("/get/member/launch")
    ResultEntity<Boolean> getInfoByMemberIdFromLaunch(@RequestParam("memberId") Integer memberId);

    //更多页面全部
    @RequestMapping("/get/more/all")
    public ResultEntity<List<PortalProjectVO>> getMoreProjectAllRemote();

    //更多页面单机
    @RequestMapping("/get/more/other")
    public ResultEntity<List<PortalProjectVO>> getMoreProjectOtherRemote(@RequestParam("typeId") Integer typeId);

    @RequestMapping("/save/member/auth")
    ResultEntity<String> saveMemberAuthVORemote(@RequestBody MemberAuthVO memberAuthVO);
}